package com.supinfo.food.services;

public class TableServiceProxy implements com.supinfo.food.services.TableService {
  private String _endpoint = null;
  private com.supinfo.food.services.TableService tableService = null;
  
  public TableServiceProxy() {
    _initTableServiceProxy();
  }
  
  public TableServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initTableServiceProxy();
  }
  
  private void _initTableServiceProxy() {
    try {
      tableService = (new com.supinfo.food.services.TableServiceServiceLocator()).getTableService();
      if (tableService != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)tableService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)tableService)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (tableService != null)
      ((javax.xml.rpc.Stub)tableService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public com.supinfo.food.services.TableService getTableService() {
    if (tableService == null)
      _initTableServiceProxy();
    return tableService;
  }
  
  public com.supinfo.food.entities.TableRestaurant[] getByMagasin(long id) throws java.rmi.RemoteException{
    if (tableService == null)
      _initTableServiceProxy();
    return tableService.getByMagasin(id);
  }
  
  public void add(com.supinfo.food.entities.TableRestaurant table) throws java.rmi.RemoteException{
    if (tableService == null)
      _initTableServiceProxy();
    tableService.add(table);
  }
  
  public void delete(long id) throws java.rmi.RemoteException{
    if (tableService == null)
      _initTableServiceProxy();
    tableService.delete(id);
  }
  
  
}